package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbDynamic;
import com.ruoyi.system.mapper.TbDynamicMapper;
import com.ruoyi.system.service.ITbDynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 动态Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbDynamicServiceImpl implements ITbDynamicService 
{
    @Autowired
    private TbDynamicMapper tbDynamicMapper;

    /**
     * 查询动态
     * 
     * @param id 动态主键
     * @return 动态
     */
    @Override
    public TbDynamic selectTbDynamicById(Long id)
    {
        return tbDynamicMapper.selectTbDynamicById(id);
    }

    /**
     * 查询动态列表
     * 
     * @param tbDynamic 动态
     * @return 动态
     */
    @Override
    public List<TbDynamic> selectTbDynamicList(TbDynamic tbDynamic)
    {
        return tbDynamicMapper.selectTbDynamicList(tbDynamic);
    }

    /**
     * 新增动态
     * 
     * @param tbDynamic 动态
     * @return 结果
     */
    @Override
    public int insertTbDynamic(TbDynamic tbDynamic)
    {
        tbDynamic.setCreateTime(DateUtils.getNowDate());
        return tbDynamicMapper.insertTbDynamic(tbDynamic);
    }

    /**
     * 修改动态
     * 
     * @param tbDynamic 动态
     * @return 结果
     */
    @Override
    public int updateTbDynamic(TbDynamic tbDynamic)
    {
        tbDynamic.setUpdateTime(DateUtils.getNowDate());
        return tbDynamicMapper.updateTbDynamic(tbDynamic);
    }

    /**
     * 批量删除动态
     * 
     * @param ids 需要删除的动态主键
     * @return 结果
     */
    @Override
    public int deleteTbDynamicByIds(Long[] ids)
    {
        return tbDynamicMapper.deleteTbDynamicByIds(ids);
    }

    /**
     * 删除动态信息
     * 
     * @param id 动态主键
     * @return 结果
     */
    @Override
    public int deleteTbDynamicById(Long id)
    {
        return tbDynamicMapper.deleteTbDynamicById(id);
    }
}
